using System.Collections;
using UnityEngine;

public class TDMinfoUI : MonoBehaviour
{
	public TDMscore score;

	public UILabel lbTimer;

	public BCWFlagControllerUI flagGrid;

	public BCWFlagControllerUI pixelmonGrid;

	private IEnumerator updateScoreCoroutine;

	private void Start()
	{
		updateScoreCoroutine = UpdateScore();
		CoroutineRunner.Instance.StartCoroutine(updateScoreCoroutine);
	}

	private void OnDestroy()
	{
		if (updateScoreCoroutine != null && CoroutineRunner.Instance != null)
		{
			CoroutineRunner.Instance.StopCoroutine(updateScoreCoroutine);
		}
	}

	private IEnumerator UpdateScore()
	{
		while (true)
		{
			score.UpdateScores();
			yield return new WaitForSeconds(0.1f);
		}
	}

	public void ShowLeaders()
	{
		GameTopWindow.instance.pvpLeaderboard.OnClick();
	}
}
